<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
    <h:head>
        <title>Crear Usuario</title>
        <link rel="shortcut icon" href="../Data/images/Saved-Data-Utility.ico" type="image/x-icon"/>
        <link rel="stylesheet" href="../Data/CSS/content.css" type="text/css"/>
    </h:head>
    <h:body>
        <h:form>
            <p:growl id="growl" showDetail="true" life="10000"/>
            <p:fieldset legend="Cuenta de Usuario" 
                        toggleable="true" toggleSpeed="500" >
                <p:ajax event="toggle"  update="growl" />

                <h:panelGrid columns="2" cellspacing="3">

                    <h:outputText value="Nombre de Usuario: " />
                    <p:inputText value="#{createUser.name}" required="true" id="UserName" requiredMessage="Por favor Ingrese un Usuario"/>

                    <h:outputText value="Autenticaci&oacute;n: " />
                    <p:selectOneMenu id="prof" value="#{createUser.tauthentication}" >  
                        <f:selectItem itemLabel="Tipo de Autenticacion" itemValue="" />  
                        <f:selectItems value="#{createUser.autenticacion}" /> 
                        <p:ajax    listener="#{createUser.handleChange}" 
                                    update="growl"/>
                    </p:selectOneMenu>

                    <h:outputText value="Contraseña: " />
                    <p:password id ="password" value="#{createUser.authentication}" />


                    <h:outputText value="Confirmar Contraseña: " />
                    <p:password id ="password2" value="#{createUser.authentication2}" />


                    <h:outputText value="Perfil " />

                    <p:selectOneMenu id="profi" value="#{createUser.profile}" 
                                     required="true" requiredMessage="Ingrese Perfil">  
                        <f:selectItem itemLabel="Selecionar Perfil" itemValue="" />  
                        <f:selectItems value="#{editProfileBean.profiles}" /> 
                    </p:selectOneMenu>

                    <h:outputText value="Contraseña caducada: " />
                    <p:selectBooleanCheckbox value="#{createUser.expires}" /> 

                    <h:outputText value="Cuenta Bloqueada: " />
                    <p:selectBooleanCheckbox value="#{createUser.lock}" /> 
                </h:panelGrid>

            </p:fieldset>

            <p:fieldset legend="TableSpace" collapsed="true"
                        toggleable="true" toggleSpeed="500" >
                <h:panelGrid columns="2" cellspacing="3">
                    <h:outputText value="Tablespace por defecto: " />
                    <p:selectOneMenu id="tablS" value="#{createUser.defaultTableSpace}" >  
                        <f:selectItem itemLabel="Selecionar TableSpace" itemValue="" />  
                        <f:selectItems value="#{createUser.tablespace}" /> 
                    </p:selectOneMenu>

                    <h:outputText value="Tablespace Temporal " />
                    <p:selectOneMenu id="tablST" value="#{createUser.temporaryTableSpace}" >  
                        <f:selectItem itemLabel="Selecionar TableSpace" itemValue="" />  
                        <f:selectItems value="#{createUser.tablespace}" /> 
                    </p:selectOneMenu>
                </h:panelGrid>


            </p:fieldset>

            <p:fieldset legend="Privilegio" collapsed="true"
                        toggleable="true" toggleSpeed="500" >
                <label for="subtitle">Lista de Privilegios</label>  
                <p:pickList id="pojoPickListUs" value="#{createUser.privileges}" 
                            var="privilege" effect="bounce"
                            itemValue="#{privilege}" itemLabel="#{privilege}" 
                            showSourceControls="false" showTargetControls="false" 
                            showSourceFilter="true" showTargetFilter="true" 
                            showCheckbox="true" filterMatchMode="contains" >  

                    <f:facet name="sourceCaption">Disponibles</f:facet>  
                    <f:facet name="targetCaption">Agregados</f:facet>  

                    <!--<p:ajax event="transfer" listener="{createUser.onTransfer}" update="growl" />-->  


                    <p:column style="width:90%;">  
                        #{privilege}  
                    </p:column>  

                </p:pickList> 
            </p:fieldset>
        
            <p:commandButton value="Crear" 
                 update="growl"
                 action="#{createUser.crear()}" 
                 style="margin-top:5px" ajax="false"
                 /> 
        </h:form>
    </h:body>
</html>
